package com.itany.corejava.day16;

import java.net.InetAddress;
import java.net.UnknownHostException;

public class TestInetAddress {

    public static void main(String[] args) throws UnknownHostException {

        InetAddress addr=InetAddress.getLocalHost();

        String ip=addr.getHostAddress();

        System.out.println(ip);

        String name=addr.getHostName();

        System.out.println(name);

        InetAddress addr2=InetAddress.getByName("www.baidu.com");

        System.out.println(addr2);



    }


}
